﻿@model Fengsoft.AIBlog.Web.Models.PagerModel
@if (Model.TotalPages>0)
{
    <ul class="pagination">
        @if (Model.PageIndex!=1)
        {
            <li>
                <a href="@(Request.Url.AbsolutePath)?@(Model.PageIndexParameterName)=1">«</a>
            </li>
        }
        @for (int i=1; i<=Model.TotalPages; i++)
        {
            string url=string.Format("{0}?{1}={2}",Request.Url.AbsolutePath,Model.PageIndexParameterName,i);
            if (i==Model.PageIndex)
            {
                <li class="active">
                    <a href="javascript:void(0);">@i</a>
                </li>
            }
            else
            {
                <li>
                    <a href="@url">@i</a>
                </li>
            }
        }
        @if (Model.PageIndex!=Model.TotalPages)
        {
            <li>
                <a href="@(Request.Url.AbsolutePath)?@(Model.PageIndexParameterName)=@Model.TotalPages">»</a>
            </li>
        }
        @*<li><a href="#">...</a></li>*@
    </ul>
}